<?php
namespace App\Shop\Controllers;

use Dingo\Api\Routing\Helpers;
use Illuminate\Routing\Controller;
use Dingo\Api\Http\Request;

class BaseController extends Controller
{
    use Helpers;

    protected $user_info = [];

    public function __construct(Request $request) {

    }

    protected function success($data = [], $message = "OK", $code = 200)
    {
        return $this->response->array([
            'success'   => true,
            'data'      => $data,
            'message'   => $message,
            'code'      => $code
        ]);
    }

    protected function error($message = "操作失败", $code = -1)
    {
        return $this->response->array([
            'success'   => false,
            'data'      => [],
            'message'   => $message,
            'code'      => $code
        ]);
    }
}
